#include<linux/module.h>
#include<linux/sched.h>
#include<linux/pid.h>
#include<linux/mm_types.h>
MODULE_LICENSE("GPL");
static int __init mmput_init(void)
{
	printk("into mmput_init.\n");
	struct pid * kpid=find_get_pid(current->pid);
	struct task_struct *task=pid_task(kpid,PIDTYPE_PID);
	struct mm_struct * mm_task=get_task_mm(task);

	printk("the mm_users of the mm_struct is:%d\n",mm_task->mm_users);
	printk("the mm_count of the mm_struct is:%d\n",mm_task->mm_count);

	printk("the tgid of the mm_struct is:%d\n",mm_task->owner->tgid);
	printk("the pid of the mm_struct is:%d\n",mm_task->owner->pid);
	mmput(mm_task);
	printk("the new value of the mm_struct after the function mmput:\n");

	printk("the mm_users of the mm_struct is:%d\n",mm_task->mm_users);
	printk("the mm_count of the mm_strcut is:%d\n",mm_task->mm_count);
	printk("the tgid of the mm_struct is:%d\n",mm_task->owner->tgid);
	printk("the pid of the mm_struct is:%d\n",mm_task->owner->pid);
	printk("the current PID is:%d\n",current->pid);
	printk("out mmput_init.\n");
	return 0;
}
static void __exit mmput_exit(void)
{
	printk("goodbye mmput\n");
}
module_init(mmput_init);
module_exit(mmput_exit);
